#ifndef _EM_CFG_H_
#define _EM_CFG_H_
//#ifdef  _EXPORT_DLL

#ifdef	_WIN32
#include	<windows.h>
#include	<process.h>
#pragma warning(disable:4786 4503)
#endif

#include	<stdio.h>
#include  <string>
#include  <map>
#include  <vector>

using namespace std;

//#endif

#ifdef	_WIN32
#pragma warning(disable:4786 4251) 
#endif


#ifdef ESTOOLS_EXPORTS
#ifdef	DLLEXPORT
#undef	DLLEXPORT
#endif
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#ifdef	_WIN32
//#pragma comment(lib,"estools.lib")
#endif

#endif
class DLLEXPORT EMCfg {
  public:
    EMCfg();
    ~EMCfg();
    EMCfg(const char * pCfgFile);
  public:
#define       EM_CFG_MAX_LEN 4096
#define      EM_CFG_OK 1
#define      EM_CFG_ERROR_FILE -1
#define      EM_CFG_ERROR_SESSION -2
#define      EM_CFG_ERROR_ITEM -3
  public:
      typedef map<string,string> Attributes;
      typedef vector<string> StringList;

  public:
    int LoadConfig(const char * pCfgFile);
    int LoadConfig();
    StringList GetSectionList();
    StringList GetItemList(string SectionName);
    Attributes *GetSectionAttributes(string SectionName);
    string GetItemValue(string SectionName,string ItemName);
    void UnloadConfig();
  private:
    typedef map<string,Attributes *> CfgMap;
  private:
    string m_CfgFile;
    CfgMap m_CfgMap;

  private:
    int iLoadCfg();

};


#endif
